/**
 * 验证手机号
 * @param {String} phone 手机号
 * @returns {Boolean}
 */
export const isPhone = (phone) => {
    return /^1[3-9]\d{9}$/.test(phone);
  };
  
  /**
   * 验证邮箱
   * @param {String} email 邮箱
   * @returns {Boolean}
   */
  export const isEmail = (email) => {
    return /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/.test(email);
  };
  
  /**
   * 验证身份证
   * @param {String} idCard 身份证
   * @returns {Boolean}
   */
  export const isIdCard = (idCard) => {
    return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(idCard);
  };
  
  /**
   * 验证是否为空
   * @param {*} value 值
   * @returns {Boolean}
   */
  export const isEmpty = (value) => {
    return value === '' || value === null || value === undefined;
  };
  
  /**
   * 验证密码
   * @param {String} password 密码
   * @returns {Boolean}
   */
  export const isPassword = (password) => {
    // 最少8位，包含大小写字母和数字
    return /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(password);
  };
  
  /**
   * 验证URL
   * @param {String} url URL
   * @returns {Boolean}
   */
  export const isUrl = (url) => {
    return /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/.test(url);
  };